//
//  LTView.m
//  LTView
//
//  Created by JR_Rafael on 15/12/16.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "LTView.h"

@implementation LTView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    
    if (self) {
        [self createLTView];
    }
    
    return self;
}

- (void)createLTView {
    // 左label
    self.myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 80, 50)];
//    _myLabel.backgroundColor = [UIColor yellowColor];
    
    // 文本对齐
//    _myLabel.textAlignment = NSTextAlignmentCenter;
    // 设置字体
    _myLabel.font = [UIFont systemFontOfSize:20];
    // 添加到LTView上
    [self addSubview:_myLabel];
    [_myLabel release];
    
    // 右Textfield
    self.myTextField = [[UITextField alloc] initWithFrame:CGRectMake(100, 0, 230, 50)];
//    _myTextField.backgroundColor = [UIColor cyanColor];
    // 自定义边框
    _myTextField.layer.borderWidth = 2;
    _myTextField.layer.borderColor = [UIColor lightGrayColor].CGColor;
    _myTextField.layer.cornerRadius = 10;
    // 删除按键
    _myTextField.clearButtonMode = UITextFieldViewModeAlways;
    _myTextField.clearsOnBeginEditing = YES;
    // 字体
    _myTextField.font = [UIFont systemFontOfSize:20];
    [self addSubview:_myTextField];
    [_myTextField release];
    
    _myTextField.delegate = self;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [_myTextField resignFirstResponder];
    return YES;
}

@end






